package com.zhike.common.enums;

import io.swagger.annotations.ApiModel;

@ApiModel(value = "响应码")
public enum ResultCode {
    SUCCESS(10000, "成功"),
    FAIL(20000, "失败"),

    IM_CREATE_TOKEN(30000, "IM Token创建失败"),
    IM_USERID_VERIFY(30001, "IM UserId登录验证不正确"),
    IM_TOKEN_VERIFY(30002, "IM Token登录验证不正确"),
    IM_JSON_PARSE(30003, "IM JSON解析失败"),
    IM_SECURITY_CHECK(30004, "安全内容检查不合法"),
    IM_SERVER_NONE(30005, "获取IM服务失败"),

    SYS_RELOGIN(40000, "请勿重复登录"),
    SYS_REQPARAMS(40001, "HTTP请求时异常"),
    SYS_ARG_VALID(40002, "参数校验失败"),
    SYS_SA_NO_TOKEN(40003, "未能读取到有效 token"),
    SYS_SA_INVALID_TOKEN(40004, "token 无效"),
    SYS_SA_TOKEN_TIMEOUT(40005, "token 已过期"),
    SYS_SA_BE_REPLACED(40006, "token 已被顶下线"),
    SYS_SA_KICK_OUT(40007, "token 已被踢下线"),
    SYS_SA_TOKEN_FREEZE(40008, "token 已被冻结"),
    SYS_SA_NO_PREFIX(40009, "未按照指定前缀提交 token"),
    SYS_SA_NO_SESSION(40010, "当前会话未登录"),
    SYS_LOGOUT(400011, "注销登录失败"),
    SYS_DEVICE_NOT_SUPPORT(40012, "不支持的设备类型"),
    SYS_OPT_BUSY(40013, "操作过于频繁，请一分钟之后再试！"),
    SYS_CONFIG_NOTFOUND(40014, "配置缺失"),
    SYS_JSON_PARSE(40015, "JSON解析错误"),
    SYS_FILE_WRITE(40016, "文件写入失败"),
    SYS_CONNECT(40017, "链接异常"),

    USER_NOT_EXSIT(41001, "用户不存在"),
    USER_PHONE_REGISTED(41002, "该手机号已注册"),
    USER_OLDPWD(41003, "旧密码错误"),
    USER_ACCOUNT_PWD(41004, "账号或密码错误"),
    USER_REG_DISENABLE(41005, "禁止注册"),
    USER_PHONE_EMPTY(41006, "手机号为空"),
    USER_PHONECODE_INVALID(41007, "手机验证码无效"),
    USER_CREATE(41008, "账号创建失败"),
    USER_AVATAR_EMPTY(41009, "未设置头像"),
    USER_AVATAR_INVALID(41010, "头像获取错误"),
    USER_PROPERTY(41011, "不支持的属性"),

    GROUP_NO_OWNER(50001, "非群主"),
    GROUP_NO_EXIST(50002, "群不存在"),
    GROUP_NO_MEMBER(50003, "群成员不存在"),
    GROUP_NO_REPEAT_INVITE(50004, "重复邀请"),
    GROUP_MEMBER_MAX(50005, "群成员已满"),
    GROUP_ADD_MEMBER(50006, "群成员加入失败"),
    GROUP_CREATE(50007, "创建群失败"),
    GROUP_NO_ID(50008, "群ID没有生成"),
    GROUP_MEMBER_DEL(50009, "群成员删除失败"),
    GROUP_MEMBER_DEL_OWNER(50010, "群主不允许删除"),
    GROUP_SET_NOSELF(50011, "不能为自己设置身份"),
    GROUP_MASTER_EXIT(50012, "群主不能退出"),
    GROUP_NORIGHT(50013, "没有群管理操作权限"),
    GROUP_PROHIBIT_INTERVAL(50014, "没有设置禁言时间"),

    MSG_NOTFOUND(60001, "未找到历史消息"),
    MSG_REVOKE_TIMEOUT(60002, "撤销已超时"),
    MSG_TARGET_SAME(60003, "目标用户不能是自己"),
    MSG_REVOKE_NORIGHT(60004, "没有撤销权限"),

    FRIEND_IN_BLACKLIST(70001, "已拉入黑名单"),
    FRIEND_RELATED(71001, "已经是好友了"),
    FRIEND_MAX(71002, "超出好友数量限制"),
    FRIEND_ERQ(71003, "已发起加好友请求"),
    FRIEND_REQ_VALID(71004, "此好友请求记录无效"),
    FRIEND_NOT_ALLOW(71005, "不允许通过此方式添加好友"),

    COLLECT_TYPE_NOSUPPORT(81001, "不支持的收藏类型"),

    VERSION(9000, "版本过低,请升级"),
    DB_ERROR(9001, "数据库错误"),
    OTHER_ERROR(9999, "其他错误,详细查看日志");

    private Integer code;
    private String message;

    private ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }
}
